package poler.classes
{
	import flash.events.EventDispatcher;
	
	/**
	 * 
	 * @author davidderaedt
	 * 
	 * Super class for Presentation Models
	 * 
	 * Common behavior for Presentation Models should be placed here.
	 * For example, a way to handle the various "show" events of a view 
	 * (borrowed from Borre Wessel & Paul Williams's PresentationModel example).
	 * 
	 * Added EventDispatcher inheritance, because your views will want
	 * to observe their PMs and update accordingly.
	 * 
	 */	

	public class AbstractPM extends EventDispatcher
	{
		
		private var firstShow:Boolean = true ;
		
		public function AbstractPM()
		{
		}
		
		public function handleShow():void
		{
			if( firstShow )
			{
				handleFirstShow();
				firstShow = false ;				
			}
			
			else handleSubsequentShows();
		}
		
		protected function handleFirstShow():void
		{
			// to be overriden
		}
		
		protected function handleSubsequentShows():void
		{
			// to be overriden
		}
	}
}